package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Dish;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 选择按盘id计数
     *
     * @param ids ids
     * @return {@link Integer}
     */
    Integer selectCountByDishIds(List<Long> ids);

    /**
     * 创建套餐
     *
     * @param setmealDishes 套餐菜肴
     */
    void creatSetmealDish(List<SetmealDish> setmealDishes);

    /**
     * 按id选择
     *
     * @param id id
     * @return {@link List}<{@link SetmealDish}>
     */
    List<SetmealDish> selectById(Long id);

    /**
     * 按ids列表删除
     *
     * @param idsList ids列表
     */
    void deleteByIdsList(List<Long> idsList);

    /**
     * 按setmeal id选择
     *
     * @param id id
     * @return {@link List}<{@link SetmealDish}>
     */
    @Select("select id, setmeal_id, dish_id, name, price, copies from setmeal_dish where setmeal_id=#{id}")
    List<SetmealDish> selectBySetmealId(Long id);

    /**
     * 通过setmeal id选择菜肴
     *
     * @param id id
     * @return {@link List}<{@link Dish}>
     */
    List<Dish> selectDishBySetmealId(Long id);
}
